package yb.ecp.fast.infra.util;

import yb.ecp.fast.infra.security.CryptoUtil;

import java.security.SecureRandom;

/**
 * Created by daishiyong on 2018/1/11.
 */
public class RandomStringUtil {
    public static String RandomString(int length){
        try{
            SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
            byte[] bytes=new byte[length/2];
            random.nextBytes(bytes);
            String appId=CryptoUtil.byteArrayToHexString(bytes);
            return appId;
        }catch (Exception e){
            return "";
        }
    }
}
